<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="<c:url value='/css/bootstrap.css' />" rel="stylesheet">
<title>Money for nothing - Accounts</title>
</head>
<body>
	<%@include file="logbar.jsp"%>
	<div class="container offset-content">
		<%@include file="title.jsp"%>
		<div class="span12 subnav">
			<ul class="pagination">
				<li><a href="<c:url value="/" />">Home</a></li>
				<li><a href="<c:url value='/accounts'/>">Accounts</a></li>
				<li class="active"><a href="<c:url value='/transfers/generate'/> ">Transfers</a></li>
			</ul>
			<ul class="nav nav-tabs">
				<li class="active"><a href="#">Transfer funds</a></li>
				<li><a href="<c:url value='/transfers/management'/> ">Accounts
						management</a></li>
			</ul>
		</div>

		<div class="container offset-content">


			<br />
			<form:form class="span12 form-horizontal" commandName="transferForm"
				id="generate-transfer-form" method="POST">
				<fieldset>
					<legend>Make a transfer</legend>

					<div class="control-group">
						<label class="control-label" for="input01">Source account</label>
						<div class="controls">
							<form:select path="transactionAccount" id="transactionAccount">
								<option value="0" label="" />
								<c:forEach items="${accountList}" var="account">
									<form:option value="${account.accountName}">${account.accountName}</form:option>
								</c:forEach>
							</form:select>
							<form:errors path="transactionAccount"
								class="errorblock alert alert-error" />
							<c:if test="${not empty accountError}">
								<div class="errorblock alert alert-error">${accountError}</div>
							</c:if>
						</div>
					</div>

					<div class="control-group">
						<label class="control-label" for="input01">Targeted
							account</label>
						<div class="controls">
							<form:select path="transferAccount" id="transferAccount">
								<option value="1" label="" />
								<c:forEach items="${accountList}" var="account">
									<form:option value="${account.getAccountName()}">${account.accountName}</form:option>
								</c:forEach>
								<c:forEach items="${targetList}" var="target">
									<form:option value="${target.accountName}">${target.accountName}</form:option>
								</c:forEach>
							</form:select>
							<form:errors path="transferAccount"
								class="errorblock alert alert-error" />
							<c:if test="${not empty accountError}">
								<div class="errorblock alert alert-error">${accountError}</div>
							</c:if>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="input01">Amount</label>
						<div class="controls">
							<div class="input-append">
								<form:input id="transactionAmount appendInput"
									path="transactionAmount" size="16" type="text" />
								<span class="add-on">$</span>
							</div>
							<form:errors path="transactionAmount"
								class="errorblock alert alert-error" />
							<c:if test="${not empty amountError}">
								<div class="errorblock alert alert-error">${amountError}</div>
							</c:if>
						</div>
					</div>
					<div class="form-actions">
						<button name="reset" type="reset" class="btn">Reset</button>
						<input type="submit" value="Submit" class="btn btn-primary" />
					</div>
				</fieldset>
			</form:form>


		</div>

		<script type="text/javascript" src="<c:url value='/js/jquery.js' />"></script>
		<script type="text/javascript"
			src="<c:url value='/js/generate-transfer.js' />"></script>



		<%@include file="footer.jsp"%>
	</div>
</body>
</html>